﻿@{
    Layout = "~/Views/Shared/_AddEdit.cshtml";
}
@section header{
    <script type="text/javascript">
        function SaveBeforeCallBack() {
           
            if ($("#_contractNumber").val() == '' ) {
                layer.tips('温馨提示：必须选择填写合同编号~！~', $("#lxxz1")); return true;
            }
            if ($("#_CustId").val() == '' || $("#_CustId").val() == null) {
                layer.tips('温馨提示：必须选择客户~！~', $("#lxxz1")); return true;
            }
            if ($("#_SetmealId") == '' || $("#_SetmealId") == null) {
                layer.tips('温馨提示：必须选择合同套餐~！~', $("#lxxz1")); return true;
            }
            if ($("#_DisPrice").val() == '' || $("#_DisPrice").val()==null) {
                layer.tips('温馨提示：必须输入金额~！~', $("#lxxz1")); return true;
            }
            if ($("#_method").val() == '') {
                layer.tips('温馨提示：必须选择付款方式~！~', $("#lxxz1")); return true;
            }

            $("#_CreateDate").val("@System.DateTime.Now");         
        }


    </script>
}
<input type="hidden" name="_ConCourseNumber" id="_ConCourseNumber" value="@ViewBag.data["ConCourseNumber"]" />
<input type="hidden" name="_SetmealName" id="_SetmealName" value="@ViewBag.data["SetmealName"]" />
<input type="hidden" name="_ContractPrice" id="_ContractPrice" value="@ViewBag.data["ContractPrice"]" />
<input type="hidden" name="_SurplusNumber" id="_SurplusNumber" value="@ViewBag.data["SurplusNumber"]" />
<input type="hidden" name="_MaxLeave" id="_MaxLeave" value="@ViewBag.data["MaxLeave"]" />
<input type="hidden" name="_Gift1Price" id="_Gift1Price" value="@ViewBag.data["Gift1Price"]" />
<input type="hidden" name="_Gift2Price" id="_Gift2Price" value="@ViewBag.data["Gift2Price"]" />
<input type="hidden" name="_Gift3Price" id="_Gift3Price" value="@ViewBag.data["Gift3Price"]" />
<input type="hidden" name="_MaxMakeUP" id="_MaxMakeUP" value="@ViewBag.data["MaxMakeUP"]" />
<input type="hidden" name="_CustId" id="_CustId"  />
<input type="hidden" name="_LinkCustId" id="_LinkCustId" />
<input type="hidden" name="_ImageUrl" id="_ImageUrl" />
<input type="hidden" name="_ImageName" id="_ImageName" />
<input type="hidden" name="_state" id="_state" value="@ViewBag.data["state"]" />
<input type="hidden" name="_status" id="_status" value="@ViewBag.data["status"]" />
<input type="hidden" name="_IsCharge" id="_IsCharge" value="@ViewBag.data["IsCharge"]" />
<input type="hidden" name="_CreateId" id="_CreateId" value="@ViewBag.data["CreateId"]" />
<input type="hidden" name="_CreateDate" id="_CreateDate" value="@ViewBag.data["CreateDate"]" />
<input type="hidden" name="_AchievementId" id="_AchievementId" value="@ViewBag.data["AchievementId"]" />
<input type="hidden" name="_LeagueId" id="_LeagueId" value="@ViewBag.data["LeagueId"]" />
<div class="layui-card-body">

    <form class="layui-form" action="" lay-filter="component-form-group">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">合同编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="_contractNumber" value="@ViewBag.data["contractNumber"]" lay-verify="title" autocomplete="off" placeholder="合同编号" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">会员卡号</label>
                <div class="layui-input-inline">
                    <input type="text" name="_CardNumber" value="@ViewBag.data["CardNumber"]" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">人员选择</label>
            <div class="layui-input-inline">
                <input type="text" id="CusDisplay" placeholder="请输入手机号码进行查询" class="layui-input" >
            </div><a class="layui-btn" href="#" onclick="searchCus()"><i class="layui-icon">&#xe615;</i></a><a class="layui-btn" href="#" onclick="clearCus()" id="lxxz1">清空</a>
        </div>
        <div class="layui-fluid layadmin-maillist-fluid">
            <div class="layui-row layui-col-space15">
                <div id="xy"></div>
            </div>
        </div>
        <div class="layui-form-item" id="xyselect" style="display:none;">
               
        </div>
        <div class="layui-form-item">
                <label class="layui-form-label">合同类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="_contracttype" lay-filter="contracttype" value="新签约" title="新签约" @(ViewBag.data["contracttype"] == "新签约" ? "checked='checked'" : "")>
                    <input type="radio" name="_contracttype" lay-filter="contracttype" value="续签" title="续签" @(ViewBag.data["contracttype"] == "续签" ? "checked='checked'" : "")>
                    <input type="radio" name="_contracttype" lay-filter="contracttype" value="赠送" title="赠送" @(ViewBag.data["contracttype"] == "赠送" ? "checked='checked'" : "")>
                    <input type="radio" name="_contracttype" lay-filter="contracttype" value="升课包" title="升课包" @(ViewBag.data["contracttype"] == "升课包" ? "checked='checked'" : "")>
                </div>
        </div>
        <div class="layui-form-item">

                <label class="layui-form-label">合同套餐</label>
                <div class="layui-input-inline">
                    <select lay-verify="required" name="_SetmealId" lay-filter="SetmealId" id="_SetmealId">
                        <option value=""></option>
                        @foreach (var data in ViewBag.SetmealType.Rows)
                        {

                            <option value="@data["id"]" @(ViewBag.data["SetmealId"] == @data["id"] ? "selected" : "")>@data["ContName"]</option>
                        }

                    </select>

                </div>
                <div class="layui-form-mid layui-word-aux" id="HdxxDisp"></div>

            
        </div>
        <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">实收金额</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="_DisPrice" id="_DisPrice" value="@ViewBag.data["DisPrice"]" lay-verify="required|number" lay-filter="DisPrice" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">赠送课时</label>
                    <div class="layui-input-inline" style="width: 100px;">
                        <input type="text" name="_GiveCourseNumber" value="@ViewBag.data["GiveCourseNumber"]" lay-verify="required|number" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">签约日期</label>
                    <div class="layui-input-block" style="width: 120px;">
                        <input type="text" name="_ContractDate" value="@ViewBag.data["ContractDate"]" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input test-laydate-item">
                    </div>
                </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">起止日期</label>
                <div class="layui-input-inline" style="width: 120px;">
                    <input type="text" name="_Constart" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input test-laydate-item">
                </div>
                <div class="layui-form-mid">-</div>
                <div class="layui-input-inline" style="width: 120px;">
                    <input type="text" name="_ConEnd" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input test-laydate-item">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">付款方式</label>
                <div class="layui-input-block" style="width: 120px;">
                    <select name="_method" id="_method" lay-verify="required">
                        <option value=""></option>
                        @foreach (var data in ViewBag.AccountMode.Rows)
                        {

                            <option value="@data["did"]" @(ViewBag.data["method"] == @data["dname"] ? "selected" : "")>@data["dname"]</option>
                        }
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
                <table style="margin-left:30px;">
                    <tr>
                        <td>赠送礼物1</td>
                        <td>
                            <div class="layui-input-inline">
                                <select lay-verify="required" name="_Gift1" lay-filter="Gift1" id="_Gift1">
                                    <option value=""></option>
                                    @foreach (var data in ViewBag.Gift.Rows)
                                    {

                                        <option title="@data["helpcode"]" value="@data["dname"]" @if (ViewBag.data["Gift1"] is System.DBNull) {} else {@(ViewBag.data["Gift1"] == @data["dname"] ? "selected" : "")}>@data["dname"]</option>
                                    }

                                </select>

                            </div>
                        </td>
                        <td> <span id="_Gift1Disp"></span></td>
                        <td rowspan="3">
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">备注</label>
                                <div class="layui-input-block">
                                    <textarea name="_Remark" placeholder="请输入内容" class="layui-textarea" style="min-height:150px;min-width:250px;"></textarea>
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>赠送礼物2</td>
                        <td>
                            <div class="layui-input-inline">
                                <select lay-verify="required" name="_Gift2" lay-filter="Gift2" id="_Gift2">
                                    <option value=""></option>
                                    @foreach (var data in ViewBag.Gift.Rows)
                                    {

                                        <option title="@data["helpcode"]" value="@data["dname"]" @if (ViewBag.data["Gift2"] is System.DBNull) {} else {@(ViewBag.data["Gift2"] == @data["dname"] ? "selected" : "")}>@data["dname"]</option>
                                    }

                                </select>

                            </div>
                        </td>
                        <td><span id="_Gift2Disp"></span></td>
                    </tr>
                    <tr>
                        <td>赠送礼物3</td>
                        <td>
                            <div class="layui-input-inline">
                                <select lay-verify="required" name="_Gift3" lay-filter="Gift3" id="_Gift3">
                                    <option value=""></option>
                                    @foreach (var data in ViewBag.Gift.Rows)
                                    {

                                        <option title="@data["helpcode"]" value="@data["dname"]" @if (ViewBag.data["Gift3"] is System.DBNull) {} else {@(ViewBag.data["Gift3"] == @data["dname"] ? "selected" : "")}>@data["dname"]</option>
                                    }

                                </select>

                            </div>
                        </td>
                        <td><span id="_Gift3Disp"></span></td>
                    </tr>
                </table>
        </div>
        <div class="layui-form-item" style="margin-left:30px;">
                <div class="layui-upload">
                    <button type="button" class="layui-btn layui-btn-normal" id="testList">选择合同附件</button>
                    <div class="layui-upload-list">
                        <table class="layui-table">
                            <thead>
                            <th>文件名</th>
                            <th>大小</th>
                            <th>状态</th>
                            <th>操作</th>
                            </thead>
                            <tbody id="demoList"></tbody>
                        </table>
                    </div>
                    <button type="button" class="layui-btn" id="testListAction">开始上传</button>
                </div>
        </div>



            @*<div class="layui-form-item layui-layout-admin">
            <div class="layui-input-block">
                <div class="layui-footer" style="left: 0;">
                    <button class="layui-btn" lay-submit="" lay-filter="component-form-demo1">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>*@
</form>

</div>


<script>
    layui.config({
        base: '../Layui/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
        }).use('index');
  


</script>
<script>
    layui.use('laydate', function () {
        var laydate = layui.laydate;

        lay('.test-laydate-item').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
                , value: new Date()
            });
        });


    });
   

</script>
<script>
    layui.use('form', function () {
        var form = layui.form;

        form.on('select(Gift1)', function (data) {        
            $('#_Gift1Price').val(data.elem[data.elem.selectedIndex].title);
            $('#_Gift1Disp').html(data.elem[data.elem.selectedIndex].title);
        });    
        form.on('select(Gift2)', function (data) {
            $('#_Gift2Price').val(data.elem[data.elem.selectedIndex].title);
            $('#_Gift2Disp').html(data.elem[data.elem.selectedIndex].title);
        });   
        form.on('select(Gift3)', function (data) {
            $('#_Gift3Price').val(data.elem[data.elem.selectedIndex].title);
            $('#_Gift3Disp').html(data.elem[data.elem.selectedIndex].title);
        });   
        form.on('select(SetmealId)', function (data) {

             
      

                  $.ajax({
                      url: "../Contract/ContractList/SetmealType",
                dataType: "json",
                data: {
                    type: "@ViewBag.type",
                    id: "@ViewBag.id",
                    keyCode: data.value,
                    t: new Date().getTime()
                },
                success: function (data) {

                    if (data.code = "0000") {
                        $('#_SetmealName').val(data.data[0].ContName);
                        $('#_DisPrice').val(data.data[0].Price);
                        $('#_ContractPrice').val(data.data[0].Price);
                        $('#_ConCourseNumber').val(data.data[0].number);
                        $('#_SurplusNumber').val(data.data[0].number);
                        $('#_MaxLeave').val(data.data[0].MaxLeave);
                        $('#_MaxMakeUP').val(data.data[0].MaxMakeUP);
                        $('#HdxxDisp').html('金额：' + data.data[0].Price + ' 课时或时长： ' + data.data[0].number + '可请假：' + data.data[0].MaxLeave + '可补课：' + data.data[0].MaxMakeUP);
                      
                    }
                }


            });

        });
    })
</script>
<script>
    layui.use('upload', function () {
        var upload = layui.upload;

        ///多文件列表示例
        var demoListView = $('#demoList')
            , uploadListIns = upload.render({
                elem: '#testList'
                , url: '../Contract/ContractList/Upload?DirName=contract'
                , accept: 'file'
                , multiple: true
                , auto: false
                , bindAction: '#testListAction'
                , choose: function (obj) {
                    var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
                    //读取本地文件
                    obj.preview(function (index, file, result) {
                        var tr = $(['<tr id="upload-' + index + '">'
                            , '<td>' + file.name + '</td>'
                            , '<td>' + (file.size / 1014).toFixed(1) + 'kb</td>'
                            , '<td>等待上传</td>'
                            , '<td>'
                            , '<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
                            , '<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
                            , '</td>'
                            , '</tr>'].join(''));

                        //单个重传
                        tr.find('.demo-reload').on('click', function () {
                            obj.upload(index, file);
                        });

                        //删除
                        tr.find('.demo-delete').on('click', function () {
                            delete files[index]; //删除对应的文件
                            tr.remove();
                            uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选
                        });

                        demoListView.append(tr);
                    });
                }
                , done: function (res, index, upload) {
                    if (res.code == 0) { //上传成功
                        var tr = demoListView.find('tr#upload-' + index)
                            , tds = tr.children();
                        tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
                        tds.eq(3).html(''); //清空操作
                        
                        if ($("#_ImageUrl").val() == "") {
                            $("#_ImageUrl").val(res.data.src);
                            $("#_ImageName").val(tds.eq(0).html());
                        }
                        else {
                            $("#_ImageUrl").val($("#_ImageUrl").val()+','+res.data.src);
                            $("#_ImageName").val($("#_ImageName").val() + ',' + tds.eq(0).html());}
                        return delete this.files[index]; //删除文件队列已经上传成功的文件
                    }
                    this.error(index, upload);
                }
                , error: function (index, upload) {
                    var tr = demoListView.find('tr#upload-' + index)
                        , tds = tr.children();
                    tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
                    tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
                }
            });
    });
</script>
<script>
    function clearCus() { $("#xy").html(''); $("#_Cid").val(""); }
    function searchCus() {

            $.ajax({
        url: "../Contract/ContractList/Data",
        dataType:"json",
        data: {
            type:"@ViewBag.type",
            id:"@ViewBag.id",
            keyCode:$("#CusDisplay").val(),
            t:new Date().getTime()
        },
        success: function( data ) {

            if (data.code = "0000") {
                var json = eval(data.data); //数组
                if (json.length == 1) {
                    if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "") {
                        $("#_CustId").val(json[0].id);
                        $("#_LinkCustId").val(json[0].LinkCustId);
                    }
                    else { $("#_CustId").val($("#_CustId").val() + ',' + json[0].id); $("#_LinkCustId").val($("#_LinkCustId").val() + ',' + json[0].LinkCustId); }
                    if (data.data[0].Sex.replace(/^\s+|\s+$/g, "") == "男") {
                        if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "")
                            $("#xy").html("<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-male layui-bg-blue\"></i><strong>" + data.data[0].CustName + "　宝宝小名:" + data.data[0].ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.data[0].CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.data[0].je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.data[0].AchievementName + "</span></strong></div><div>联系人:" + data.data[0].LinkName + "<br>关系:" + data.data[0].LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.data[0].address + "</p></div></div></div>");
                        else
                            $("#xy").html($("#xy").html() + "<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-male layui-bg-blue\"></i><strong>" + data.data[0].CustName + "　宝宝小名:" + data.data[0].ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.data[0].CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.data[0].je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.data[0].AchievementName + "</span></strong></div><div>联系人:" + data.data[0].LinkName + "<br>关系:" + data.data[0].LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.data[0].address + "</p></div></div></div>");
                    } else {
                        if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "")
                            $("#xy").html("<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-female\" style=\"background-color: #FFC0CB;color: #fff !important\" ></i><strong>" + data.data[0].CustName + "　宝宝小名:" + data.data[0].ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.data[0].CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.data[0].je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.data[0].AchievementName + "</span></strong></div><div>联系人:" + data.data[0].LinkName + "<br>关系:" + data.data[0].LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.data[0].address + "</p></div></div></div>");
                            else
                        $("#xy").html($("#xy").html() + "<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-female\" style=\"background-color: #FFC0CB;color: #fff !important\" ></i><strong>" + data.data[0].CustName + "　宝宝小名:" + data.data[0].ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.data[0].CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.data[0].je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.data[0].AchievementName + "</span></strong></div><div>联系人:" + data.data[0].LinkName + "<br>关系:" + data.data[0].LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.data[0].address + "</p></div></div></div>");
                    }
                    
                    $("#_AchievementId").val(json[0].LatelyReceId);
                    $("#xyselect").css('display', 'none');
                }
                else if (json.length > 1) {
                    $("#xyselect").css('display', '');
                  
                    layui.use('layer', function () {
                        var layer = layui.layer;
                        layer.open({
                            title: '请选择合同人员信息',
                            type: 1,
                            shadeClose: true,
                            area: ['700px', '500px'],
                            content: $("#xyselect").html("<table class=\"layui - table\" lay-skin=\"line\" lay-filter=\"demo\" id=\"demo\"></table>"),
                            cancel: function (index, layero) {
                                if (confirm('确定要关闭么')) { //只有当点击confirm框的确定时，该层才会关闭
                                  
                                    $("#xyselect").html('');
                                    layer.close(index)
                                }
                                return false;
                            }    
                        });
                    })
                    layui.use('table', function () {
                        var table = layui.table;
                        table.render({
                            elem: '#demo'
                            , cols: [[ //标题栏
                                { field: 'id', title: 'ID', width: 60, sort: true }
                                , { field: 'CustName', title: '宝宝姓名', width: 100 }
                                , { field: 'ChildName', title: '小名', Width: 80 }
                                , { field: 'LinkName', title: '联系人', Width: 80 }
                                , { field: 'CustTel', title: '联系电话', minwidth: 100 }
                                , { field: 'LinkRelation', title: '关系', width: 80 }
                            ]]
                            , data: data.data
                            , skin: 'line' //表格风格
                            , even: true
                            , page: true //是否显示分页

                            , limit: 5 //每页默认显示的数量

                        });
                        table.on('row(demo)', function (obj) {

                            var data = obj.data;
                            if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "") {
                                $("#_CustId").val(data.id);
                                $("#_LinkCustId").val(data.LinkCustId);
                            }
                            else { $("#_CustId").val($("#_CustId").val() + ',' + data.id); $("#_LinkCustId").val($("#_LinkCustId").val() + ',' + data.LinkCustId); }
                            if (data.Sex.replace(/^\s+|\s+$/g, "") == "男") {
                                if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "")
                                    $("#xy").html("<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-male layui-bg-blue\"></i><strong>" + data.CustName + "　小名:" + data.ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.AchievementName + "</span></strong></div><div>联系人:" + data.LinkName + "<br>关系:" + data.LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.address + "</p></div></div></div>");
                                else
                                    $("#xy").html($("#xy").html() + "<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-male layui-bg-blue\"></i><strong>" + data.CustName + "　小名:" + data.ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.AchievementName + "</span></strong></div><div>联系人:" + data.LinkName + "<br>关系:" + data.LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.address + "</p></div></div></div>");
                            } else {
                                if ($("#xy").html() == "未找到学员信息" || $("#xy").html() == "")
                                    $("#xy").html("<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-female\" style=\"background-color: #FFC0CB;color: #fff !important\" ></i><strong>" + data.CustName + "　小名:" + data.ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.AchievementName + "</span></strong></div><div>联系人:" + data.LinkName + "<br>关系:" + data.LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.address + "</p></div></div></div>");
                                    else
                                $("#xy").html($("#xy").html() + "<div class= \"layui-col-md4 layui-col-xs4\"><div class=\"layadmin-contact-box\"><i class=\"layui-icon layui-icon-female\" style=\"background-color: #FFC0CB;color: #fff !important\" ></i><strong>" + data.CustName + "　小名:" + data.ChildName + "</strong><br><addr title=\"phone\">Tel:</addr><span class=\"layui-badge layui-bg-orange\">" + data.CustTel + "</span><div class=\"layadmin-address\"><strong>订金:<span class=\"layui-badge\">" + data.je + "</span>　业绩所属:<span class=\"layui-badge layui-bg-green \">" + data.AchievementName + "</span></strong></div><div>联系人:" + data.LinkName + "<br>关系:" + data.LinkRelation + "<br><p class=\"layadmin-textimg\"> <i class=\"layui-icon layui-icon-location\"></i>" + data.address + "</p></div></div></div>");
                            }
                           
                          
                            $("#_AchievementId").val(data.LatelyReceId);
                            layer.closeAll('page');
                            $("#xyselect").html('');
                         
                        });

                    });
                  
                   
                }
                else {
                    if ($("#xy").html() == '')
                    {
                        $("#xy").html("未找到学员信息");
                        $("#_Cid").val("");
                    }
                    else
                        layer.alert("未找到学员信息");
                   
                    $("#_AchievementId").val("");
                    $("#xyselect").css('display', 'none');
                }

            }

        }
    });
    }

</script>
